home *** CD-ROM | disk | FTP | other *** search
- /*
- Stay Off If Up Hack - PalmOS Hack to stop the Palm V turning on if the
- up button is held down.
-
- Copyright (C) 2000 Duncan Sargeant
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- */
-
-
-
- #include <Pilot.h>
- #include <System/Globals.h>
- #include <System/AlarmPrv.h>
- #include <Hardware/Hardware.h>
- #include <System/KeyMgr.h>
-
- #define mycreator 'upoh'
-
- #define myresourceid 1000
-
- void MySysTrapSleep (Boolean untilReset, Boolean emergency) {
- DWord keystate, temp;
- void (*oldtrap)(Boolean, Boolean);
-
- /* first do everything a normal sleep would do by calling the real one */
- FtrGet (mycreator, myresourceid, &temp);
- oldtrap = (void (*)(Boolean, Boolean)) temp;
- oldtrap(untilReset, emergency);
-
- /* we don't really want to fuck with things in these situations */
- if (untilReset || emergency) {
- return;
- }
-
- /* this loop ensures that if the up scroll key is pressed
- down, then the pilot goes back to sleep. The exception is
- when an alarm is triggered (for obvious reasons). */
-
- keystate = KeyCurrentState();
- while (keystate & keyBitPageUp
- && !((AlmGlobalsPtr) GAlmGlobalsP)->triggered) {
- HwrSleep (0, 0);
- keystate = KeyCurrentState();
- }
- }
-